package com.lrkj.phone.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.phone.mapper.AppUserMapper;
import com.lrkj.phone.domain.AppUser;
import com.lrkj.phone.service.IAppUserService;

/**
 * app用户Service业务层处理
 *
 * @author yajun_ren
 * @date 2021-04-09
 */
@Service
public class AppUserServiceImpl implements IAppUserService
{
    @Autowired
    private AppUserMapper appUserMapper;

    /**
     * 查询app用户
     *
     * @param appUserId app用户ID
     * @return app用户
     */
    @Override
    public AppUser selectAppUserById(String appUserId)
    {
        return appUserMapper.selectAppUserById(appUserId);
    }

    /**
     * 查询app用户列表
     *
     * @param appUser app用户
     * @return app用户
     */
    @Override
    public List<AppUser> selectAppUserList(AppUser appUser)
    {
        return appUserMapper.selectAppUserList(appUser);
    }

    /**
     * 新增app用户
     *
     * @param appUser app用户
     * @return 结果
     */
    @Override
    public int insertAppUser(AppUser appUser)
    {
        appUser.setAppUserId(IdUtils.simpleUUID());
        appUser.setCreateTime(DateUtils.getNowDate());
        return appUserMapper.insertAppUser(appUser);
    }

    /**
     * 修改app用户
     *
     * @param appUser app用户
     * @return 结果
     */
    @Override
    public int updateAppUser(AppUser appUser)
    {
        appUser.setUpdateTime(DateUtils.getNowDate());
        return appUserMapper.updateAppUser(appUser);
    }

    /**
     * 批量删除app用户
     *
     * @param appUserIds 需要删除的app用户ID
     * @return 结果
     */
    @Override
    public int deleteAppUserByIds(String[] appUserIds)
    {
        return appUserMapper.deleteAppUserByIds(appUserIds);
    }

    /**
     * 删除app用户信息
     *
     * @param appUserId app用户ID
     * @return 结果
     */
    @Override
    public int deleteAppUserById(String appUserId)
    {
        return appUserMapper.deleteAppUserById(appUserId);
    }

    @Override
    public AppUser selectAppUserByOpenId(String openId) {
        return appUserMapper.selectAppUserByOpenId(openId);
    }

    @Override
    public AppUser selectAppUserByUserName(String userName) {
        return appUserMapper.selectAppUserByUserName(userName);
    }
}
